package zhuyun.code.itemdecorationdemo.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import zhuyun.code.itemdecorationdemo.R
import zhuyun.code.itemdecorationdemo.RecyclerAdapter
import zhuyun.code.itemdecorationdemo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    private val itemDatas:MutableList<String> = mutableListOf()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<ActivityMainBinding>(this,R.layout.activity_main)
        for(index in 0 until 20) {
            itemDatas.add("${index} Test")
        }
        val recyclerAdapter = RecyclerAdapter(itemDatas)
        binding.recyclerview.layoutManager = LinearLayoutManager(this)
        binding.recyclerview.adapter = recyclerAdapter
        val timelineItemDecoration = TimelineItemDecoration(this)
        binding.recyclerview.addItemDecoration(timelineItemDecoration)
    }
}
